package com.lwc.backendsinglestructure.domain.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.keygen.KeyGenerators;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 操作日志
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("operation_log")
public class OperationLog {

    @Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
    private Long id;
    @Column("module")
    private String module;
    @Column("api")
    private String api;
    @Column("method")
    private String method;
    @Column("title")
    private String title;
    @Column("description")
    private String description;
    @Column("params")
    private String params;
    @Column("result")
    private String result;
    @Column("cost_time")
    private Long cost_time;
    @Column("ip")
    private String ip;
    @Column("browser")
    private String browser;
    @Column("user_id")
    private Long userId;
    @Column(value = "create_time",onInsertValue = "CURRENT_TIMESTAMP")
    private LocalDateTime createTime;
    @Column(value = "update_time",onUpdateValue = "CURRENT_TIMESTAMP",onInsertValue = "CURRENT_TIMESTAMP")
    private LocalDateTime updateTime;
    @Column(value = "is_delete",isLogicDelete = true)
    private Integer isDelete;
}
